Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

390
Vistas
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'models' imported from

I'm trying to configure my project to use absolute imports, so I have configured jsconfig.json as follows:

{
    "compilerOptions": {
       "baseUrl": "./src",
       "module": "commonjs",
       "target": "es2016"
    },
   "exclude": ["node_modules", "**/node_modules/*"]
}

My project structure looks like this:

enter image description here

but when I try to do an import like import { Account } from "models"; I get the following error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'models' imported from...

How can I solve this ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The jsconfig.json file is used by VSCode's language server for static JavaScript analysis, it is not read by Node.js and therefore doesn't affect module loading in any way.

Options which come to mind are to use a transpiler, for example tsc, to transpile JS files (see this answer), or use native ESM support in Node.js possibly with custom loader. Mind that by default ESM imports expect full filename, including file extension (omitting file extensions in ESM is TypeScript specific quirk).

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda